﻿
namespace SpringSeries.Core.SetterInjection
{
    public class PhraseTranslator
    {
        private ITranslator _concreteTranslator = null;
        private ITranslatorLog _log = new NullTranslatorLog();

        public ITranslatorLog Log
        {
            set { _log = value; }
        }

        public PhraseTranslator(ITranslator concreteTranslator)
        {
            _concreteTranslator = concreteTranslator;
        }

        public string Translate(string phraseToTranslate)
        {
            string phraseTranslated = _concreteTranslator.Translate(phraseToTranslate);

            _log.LogTranslation(phraseToTranslate, phraseTranslated);

            return phraseTranslated;
        }
    }
}
